/*
* normalize join
*
* */
const {basename, extname, dirname, parse, format, sep, delimiter, win32, posix, resolve,normalize,join} = require('path')

// 
console.log(normalize('/usr//local/../bin'))
console.log(normalize('/usr//local/bin'))


// 自动处理路径
console.log('join')
console.log(join('/usr', '../local', 'bin'))
console.log(join('/usr', 'local', 'bin/'))

// resolve
console.log('resolve')
console.log(resolve("../"))
console.log(resolve('../', 'local'))
console.log(resolve('local'))

// console.log(basename)
const p = '/usr/local/guaguaerhao/index.html'
console.log(basename(p))

console.log(dirname(p))

console.log(extname(p))


// parse 会将路径解析为 pathObject
const pathObject = parse(p)
console.log(pathObject)

// format 会将pathObject转换为路径
console.log(format(pathObject))

// sep node提供的路径分隔符，会根据平台自动变换 / 和 \
console.log(p.split(sep))

// 提供平台特定的路径定界符 ; 和 :
console.log(delimiter)



